@extends('app')
@section('content')
<div class="post">
	<form action="{{ url('archive/edit') }}" method="post">
	{{ csrf_field() }}
	<input type="hidden" name="archive_id" value="{{ $archive->id }}">
	  <div class="form-group">
	    <label>Title</label>
	    <input type="text" class="form-control" name='title' value="{{ $archive->title }}">
	  </div>
	  <div class="form-group">
	    <label>Content</label><br>
	    <textarea class="form-control" name="text" rows="20">{{ $archive->text }}
	    </textarea>
	  </div>
	  <div class="form-group">
	    <label>Category</label><br>
	    <select name="category_id" class="form-control">
	    	@foreach ($categorys as $category)
	    	@if ($category->id == $archive->category_id)
	    	<option value="{{ $category->id }}" selected>{{ $category->category_name }}</option>
	    	@else
	    	<option value="{{ $category->id }}">{{ $category->category_name }}</option>
	    	@endif
	    	@endforeach
	    </select>
	  </div>
	  <input class="btn btn-primary form-group" type="submit" value="Submit">
	</form>
</div>
@endsection